<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>新建一个  OAuthProvider 对象</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="oauthprovider.checkoauthrequest.html">« OAuthProvider::checkOAuthRequest</a></li>
      <li style="float: right;"><a href="oauthprovider.consumerhandler.html">OAuthProvider::consumerHandler »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.oauthprovider.html">OAuthProvider</a></li>
    <li>新建一个  OAuthProvider 对象</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="oauthprovider.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">OAuthProvider::__construct</h1>
  <p class="verinfo">(PECL OAuth &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">OAuthProvider::__construct</span> &mdash; <span class="dc-title">新建一个  OAuthProvider 对象</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-oauthprovider.construct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>OAuthProvider::__construct</strong></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$params_array</code><span class="initializer"> = ?</span></span>)</div>

  <p class="para rdfs-comment">
  发起一个新的 <span class="classname"><a href="class.oauthprovider.html" class="classname">OAuthProvider</a></span> <span class="type"><span class="type 对象">对象</span></span>。
  </p>

  <div class="warning"><strong class="warning">警告</strong><p class="simpara">本函数还未编写文档，仅有参数列表。</p></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-oauthprovider.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">params_array</code></dt>

    <dd>

     <p class="para">
      设置限制 <a href="features.commandline.html" class="link">CLI SAPI</a> 的可选参数。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-oauthprovider.construct-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回一个 <span class="classname"><a href="class.oauthprovider.html" class="classname">OAuthProvider</a></span> <span class="type"><span class="type 对象">对象</span></span>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-oauthprovider.construct-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-5319">
   <p><strong>示例 #1 <span class="function"><strong>OAuthProvider::__construct()</strong></span> 例子</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">try&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$op&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">OAuthProvider</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;使用用户定义的回调函数<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$op</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">consumerHandler</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$this</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'lookupConsumer'</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$op</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">timestampNonceHandler</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$this</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'timestampNonceChecker'</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$op</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">tokenHandler</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$this</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'myTokenHandler'</span><span style="color: #007700">));<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;忽略&nbsp;foo_uri&nbsp;参数<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$op</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setParam</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo_uri'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;对于终点不需要令牌<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$op</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setRequestTokenPath</span><span style="color: #007700">(</span><span style="color: #DD0000">'/v1/oauth/request_token'</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$op</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">checkOAuthRequest</span><span style="color: #007700">();<br /><br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">OAuthException&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">OAuthProvider</span><span style="color: #007700">::</span><span style="color: #0000BB">reportProblem</span><span style="color: #007700">(</span><span style="color: #0000BB">$e</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-oauthprovider.construct-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="methodname"><a href="oauthprovider.setparam.html" class="methodname" rel="rdfs-seeAlso">OAuthProvider::setParam()</a> - 设置一个参数</span></li>
  </ul>
 </div>


</div></div></div></body></html>